package com.kingdee.eas.custom.common.client;

import java.util.Calendar;
import java.util.Date;

import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;

public class CanonFilterUtils {

	public static FilterInfo getResignFilter(String field, Date d) {

		FilterInfo fi = new FilterInfo();

		fi.getFilterItems().add(
				new FilterItemInfo(field, d, CompareType.LESS_EQUALS));

		Calendar c = Calendar.getInstance();
		c.setTime(d);

		c.set(Calendar.DAY_OF_MONTH, 1);
		c.set(Calendar.HOUR_OF_DAY, 0);
		c.set(Calendar.MINUTE, 0);
		c.set(Calendar.SECOND, 0);
		c.set(Calendar.MILLISECOND, 0);

		fi.getFilterItems().add(
				new FilterItemInfo(field, c.getTime(),
						CompareType.GREATER_EQUALS));

		fi.getFilterItems().add(
				new FilterItemInfo("employeetype.employeefenlei.id",
						"00000000-0000-0000-0000-0000000000035C14FC3A",
						CompareType.EQUALS));
		fi.getFilterItems()
				.add(new FilterItemInfo(field, null, CompareType.IS));
		fi.setMaskString("(#0 and #1 and #2) or #3");
		return fi;

	}
}
